
<% if session[:user] %>
<div id="left">
<h4>เพิ่ม Marker</h4>
<%  form_for(:subtourist, :url => tourist_subtourists_path(@tourist), :html => { :method => :post, :class => "edit_post", :id => "new_map"}) do |f| %>
   <p>ชื่อ:</p><%= f.text_field(:name, :size => 20) %><br></br>
   <p>รายละเอียด:<br/>
   <%= f.text_area( :detail, :cols => 18, :rows => 10)  %></p>
    <%= f.hidden_field(:lat,:value =>13.688687769784968) %>
    <%= f.hidden_field(:long,:value =>100.458984375) %><br/>
   ราคา:<%= f.text_field(:price,:size => 20) %><br/>
   <%= f.submit "สร้าง" %>
<%end %>
<iframe scrolling="no" height="500" frameborder="0" width="800" src="../upload/new" marginwidth="0" marginheight="0"></iframe>
</div>
 <div id="right">
<p>
  <b>Name:</b>
  <%=h @tourist.name %>
</p>
<table>
  <tr >
    <td>
      <%= map :width => "450", :height => "350",
  :center => @tourist.log+","+@tourist.lat,
  :markers => [
    {:point => @tourist.log+","+@tourist.lat,
     :text => @tourist.detail}],
  :maker => @tourist.subtourists
 %>
    </td>
    <td align="left" style=" vertical-align: top;">
            <div style="vertical-align: top;">
              <label>เลือกแผนการเที่ยว</label><br/>
              <select name="plan">
             <% @plan.each do |p| %>
                <option onclick="selectplan(<%= h p.id %>)" value="<%= h p.id %>"><%= h p.desc %></option>
             <% end %>
             </select></div>
      <div style="vertical-align: top;">
         <label>เพิ่มสถานที่เที่ยวลงในแผน</label><br/>
        <ul >
  <% i =0
  @tourist.subtourists.each do |subtourist| %>
  <li>   
    <% i+=1 %><%= i %>.<%= h subtourist.name %><input type="button" onclick="addtolistplan(<%=session[:id]%>,<%=subtourist.id %>,1)" name="subtourist_id" value="เพิ่ม" ></input>
  </li>
  <% end %>
</ul></div>
    </td>
  </tr>
</table>

<p>
  <b>Lat:</b>
  <%=h @tourist.lat %>
  <b>Log:</b>
  <%=h @tourist.log %>
</p>
<div class="node sticky">
        <h2 class="title"><%=h @tourist.province %></h2>
        <span class="submitted">Submitted on <%=h @tourist.created_at %>
        <span class="user_badges">
        </span> </span>
        <div class="content">
          <div style="margin: 1px 1px 5px; padding: 1px; background-color: rgb(255, 255, 255);">
            <div style="margin-left: 0pt; padding-left: 0px; margin-top: 0pt; margin-bottom: 0pt; padding-right: 5px; position: relative;">
              <div style="margin-top: 5px; margin-bottom: 5px;">
                  <%    if @tourist.img != nil
                           @mugshots = Mugshot.find_all_by_filename(@tourist.img)
                           i =0
                           for mugshot in @mugshots do
                             if i==0
                            %>
                              <div style="float: left;">
                              <%= link_to image_tag(mugshot.public_filename,:size => "200x150"), mugshot.public_filename %>
                              </div>
                  <%         i=i+1
                             end
                          end
                      end %>
                 <div style="float: left; width: 180px; padding-left: 10px;">
                    <p><%=h @tourist.detail %></p>
                    </div> <div style="clear: both;"></div> </div> </div> </div>
        </div>
  </div>

  <%
    @posts = Post.find_all_by_ptype("1") %>

  <% for post in @posts %>
  <% if post.published %>
<div class="node sticky">
        <h2 class="title"><%=h post.title %></h2>
        <span class="submitted">Submitted on <%=h post.created_at %>
        <span class="user_badges">
        </span> </span>
        <div class="content">
          <div style="margin: 1px 1px 5px; padding: 1px; background-color: rgb(255, 255, 255);">
            <div style="margin-left: 0pt; padding-left: 0px; margin-top: 0pt; margin-bottom: 0pt; padding-right: 5px; position: relative;">
              <div style="margin-top: 5px; margin-bottom: 5px;">
                  <%    if post.img != nil
                           @mugshots = Mugshot.find_all_by_filename(post.img)
                           i =0
                           for mugshot in @mugshots do
                             if i==0
                            %>
                              <div style="float: left;">
                              <%= link_to image_tag(mugshot.public_filename,:size => "150x120"), mugshot.public_filename %>
                              </div>

                  <%         i=i+1
                             end
                          end
                      end %>
                 <div style="float: left; width: 180px; padding-left: 10px;">
                    <p><%=h post.intro %></p>
                    </div> <div style="clear: both;"></div> </div> </div> </div>

        </div>
	<div class="nlinks">»
          <ul class="links inline">
            <li class="blog_usernames_blog first">
              <%=
              if post.author
               "โพสโดย "+ post.author
              end
            %>
            </li>
            <li class="comment_comments">
                <%= link_to post.comments.length.to_s+"comments",
                 :action => "show",
                 :id => post %>
            </li>
            <li class="node_read_more last">
                  <%= link_to "อ่านทั้งหมด",
      :action => "show",
      :id => post %>
            </li>
         </ul>
        </div>
  </div>
  <% end %>
<% end %>


<%= link_to 'Edit', edit_tourist_path(@tourist) %> |
<%= link_to 'Back', tourists_path %>
</div>
  <% else %>
  <p>สมัครสมาชิกเพื่อใช้งานเว็บ</p>
<% end %>